package com.weixing.mall.provider.util;

import com.weixing.mall.provider.model.enums.InfoPerfectEnum;

/**
 * @ClassName InfoPerfectUtil
 * @Description
 * @Author Small
 * @Date 2019/12/19 20:12
 * @Version 1.0
 **/
public class InfoPerfectUtil {


    /**
     * 方法描述: 增加完善信息
     * @Author Small
     * @param flag
     * @param infoPerfect
     * @Date 2019/12/20 14:50
     * @return int
    */
    public static int add(int flag ,InfoPerfectEnum infoPerfect){
        return flag | infoPerfect.getValue();
    }


    /**
     * 方法描述:基础信息是否已维护
     * @Author Small
     * @param flag
     * @Date 2019/12/20 14:03
     * @return boolean
     */
    public static boolean isBasicPerfect(long flag) {
        return (flag & InfoPerfectEnum.BASIC.getValue()) == InfoPerfectEnum.BASIC.getValue();
    }

    /**
     * 方法描述: 身份详细信息是否已维护
     * @Author Small
     * @param flag
     * @Date 2019/12/20 14:06
     * @return boolean
     */
    public static boolean isInfoPerfect(long flag) {
        return (flag & InfoPerfectEnum.INFO.getValue()) == InfoPerfectEnum.INFO.getValue();
    }

    /**
     * 方法描述: 结算信息是否已维护
     * @Author Small
     * @param flag
     * @Date 2019/12/20 14:07
     * @return boolean
     */
    public static boolean isSettlePerfect(long flag) {
        return (flag & InfoPerfectEnum.SETTLE.getValue()) == InfoPerfectEnum.SETTLE.getValue();
    }

    public static void main(String[] args) {

        int add = add(0, InfoPerfectEnum.BASIC);
        add = add(add,InfoPerfectEnum.INFO);
        add = add(add,InfoPerfectEnum.SETTLE);

        System.out.println(add);
    }
}
